<template>
	<view class="body" id="container">
		<view class="head">
			<view class="head_left" @tap="back()">
				<image src="../../../static/wode/return.png" mode=""></image>
				<text>返回</text>
			</view>
			<view class="head_mid" v-text="ThisName"></view>
			<view class="head_right">
				<!-- <image src="../../../static/jingyou/translate.png" mode=""></image> -->
				<!-- <image src="../../../static/wode/shezhi.png" mode="" @tap="toTalkSet"></image> -->
			</view>
		</view>
		<!-- 消息渲染列表 -->
		<view :class="isDJ==true?'body_itemA':'.body_itemB'">
			<!--我发送的语音-->
			<!-- 	<view>
				<view class="time">
					12-13 17:31
				</view>
				<view class="meTalk">
					<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
					<view class="item_box2">
						<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
						<image class="voice-size active" src="../../../static/jingyou/aiuto.png"></image>
					</view>
					<view class="duration active">54''</view>
				</view>
			</view> -->
			<!--我发送的语音-->

			<!--对方发的语音-->
			<!-- <view>
				<view class="time">
					12-13 17:31
				</view>
				<view class="otherTalk">
					<view class="head_box">
						<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
						<image class="country" src="../../../static/meiguo.png" mode=""></image>
					</view>
					<view class="item_box1">
						<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_Inputbox.png" mode=""></image>
						<image class="voice-size" src="../../../static/jingyou/aiuto.png"></image>
						<view class="unread"></view>
					</view>
					<view class="duration">54''</view>
				</view>
			</view> -->
			<!--对方发的语音-->

			<!--我发的图片-->
			<!-- <view>
				<view class="time">
					12-13 17:31
				</view>
				<view class="meTalk">
					<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
					<image class="sendImg-me" src="../../../static/avatar.jpg"></image>
				</view>
			</view> -->
			<!--我发的图片-->

			<!--对方发的图片-->
			<!-- <view>
				<view class="time">
					12-13 17:31
				</view>
				<view class="otherTalk">
					<view class="head_box">
						<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
						<image class="country" src="../../../static/meiguo.png" mode=""></image>
					</view>
					<image class="sendImg-me" src="../../../static/avatar.jpg"></image>
				</view>
			</view> -->
			<!--对方发的图片-->


			<!-- 我发的红包 -->
			<!-- <view class="meRed" @tap="isOpenRed">
				<view class="time">
					12-13 17:31
				</view>
				<view class="meTalk">
					<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
					<view class="item_box3">
						<image src="../../../static/jingyou/redMsg.png" mode=""></image>
						<view class="redTextBox">
							<text>大吉大利</text>
						</view>
					</view>
				</view>
			</view> -->
			<!-- 其他人发的红包 -->
			<!-- <view>
				<view class="time">
					12-13 17:31
				</view>
				<view class="otherTalk">
					<view class="head_box">
						<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
						<image class="country" src="../../../static/meiguo.png" mode=""></image>
					</view>
					<view class="item_box3 isopen">
						<image src="../../../static/jingyou/redMsg.png" mode=""></image>
						<view class="redTextBox">
							<text>大吉大利</text>
							<text>(已被领取)</text>
						</view>

					</view>
				</view>
			</view> -->



			<view class="talkBox" v-for="(item,index) in meTextMsg" :key="index">
				<!--我发送的消息-->
				<view v-if="item.fromAccount == user_id">
					<view class="time" v-text="item.time">
						<!-- 昨天 17:31 -->
					</view>
					<view class="meTalk" v-if="item.type=='text'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<!-- 文字 -->
							<view class="talk_item" v-text="item.text">
								<!-- 嗨，很高兴认识你。 -->
							</view>
						</view>
					</view>
					<view class="meRed" v-else-if="item.type=='redenvelopes'" @tap="isOpenRed(item.content)">
						<view class="meTalk">
							<image class="headImg" :src="user_info.avatar" mode=""></image>
							<view class="item_box3" v-if="item.content.status==1">
								<image src="../../../static/jingyou/redMsg.png" mode=""></image>
								<view class="redTextBox">
									<text>{{item.content.remarks}}</text>
								</view>

							</view>
							<view class="item_box3 isopen" v-else @tap="isOpenRed(item.content)">
								<image src="../../../static/jingyou/redMsg.png" mode=""></image>
								<view class="redTextBox">
									<text>{{item.content.remarks}}</text>
									<text>(已被领取)</text>
								</view>

							</view>
						</view>
					</view>
					<view class="" v-else-if="item.type=='gift'">
						<view class="meGift" v-if="item.content.sendUserId==user_id">
							<image src="../../../static/wode/setGift.png" mode=""></image>
							<view class="giftText">你给{{item.content.nickName}}发送了礼物<text @tap="toGiftCenter">礼物中心</text></view>
						</view>
						<view class="meGift" v-else>
							<image src="../../../static/wode/setGift.png" mode=""></image>
							<view class="giftText">{{item.content.sendNickName}}给你发送了礼物<text @tap="toGiftCenter">礼物中心</text></view>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='card'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2 mingpianBox">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<!-- 名片 -->
							<view class="mingpian">
								<view class="mingpian_top">
									<image :src="item.content.userIcon" mode=""></image>
									<text>{{item.content.userNickName}}</text>
								</view>
								<view class="mingpian_bottom">[个人名片]</view>
							</view>
						</view>
					</view>
					<view class="" v-else-if="item.type=='redtip'">
						<view class="meGift">
							<image src="../../../static/wode/littleRed.png" mode=""></image>
							<view class="giftText">你领取了{{item.content.sendNickName}}的<text class="text3">红包</text></view>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videoMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">发起视频<text class="test">&#xe64f;</text></text>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videocancelMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">已取消<text class="test">&#xe64f;</text></text>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videorefuseMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">已拒绝<text class="test">&#xe64f;</text></text>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videoHangupMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">通话时长 {{item.content.meesageTime}}<text class="test">&#xe64f;</text></text>
						</view>
					</view>
				</view>
				<!--我发送的消息-->

				<!--对方发送的消息-->
				<view v-else>
					<view class="time" v-text="item.time"></view>
					<view class="otherTalk" v-if="item.type=='text'">
						<view class="head_box">
							<image v-if="selType=='C2C'" class="headImg" :src="friendHeadUrl" mode=""></image>
							<!-- <image class="country" src="../../../static/meiguo.png" mode=""></image> -->
							<image v-else :src="item.fromAccountHeadurl" mode=""></image>
						</view>
						<view class="text_box">
							<text v-if="selType==GROUP">{{item.name}}</text>
							<view class="item_box1">
								<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_Inputbox.png" mode=""></image>
								<view class="talk_item wenzi" v-text="item.text"></view>
								<image class="fanyi" src="../../../static/jingyou/translate.png" mode="" @tap="fanyiThis(item.text,index)"></image>
								<view class="afterText" v-if="showAfterFanyi==true&&index==fanyiIndex">
									{{afterFanyi}}
								</view>
							</view>
						</view>


					</view>
					<view class="otherTalk" v-else-if="item.type=='redenvelopes'">
						<view class="head_box">
							<image class="headImg" :src="friendHeadUrl" mode=""></image>
							<!-- <image class="country" src="../../../static/meiguo.png" mode=""></image> -->
						</view>
						<view class="item_box3 isopen" v-if="item.content.status==2" @tap="isOpenRed(item.content)">
							<image src="../../../static/jingyou/redMsg.png" mode=""></image>
							<view class="redTextBox">
								<text>{{item.content.remarks}}</text>
								<text>(已被领取)</text>
							</view>
						</view>
						<view class="item_box3" v-else @tap="isOpenRed(item.content)">
							<image src="../../../static/jingyou/redMsg.png" mode=""></image>
							<view class="redTextBox">
								<text>{{item.content.remarks}}</text>
							</view>
						</view>
					</view>
					<view class="otherTalk" v-else-if="item.type=='card'">
						<view class="head_box">
							<image class="headImg" src="../../../static/avatar.jpg" mode=""></image>
							<image class="country" src="../../../static/meiguo.png" mode=""></image>
						</view>
						<view class="item_box1">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_Inputbox.png" mode=""></image>
							<view class="mingpian">
								<view class="mingpian_top">
									<image :src="item.content.userIcon" mode=""></image>
									<text>{{item.content.userNickName}}</text>
								</view>
								<view class="mingpian_bottom">[个人名片]</view>
							</view>
						</view>
					</view>
					<view class="" v-else-if="item.type=='gift'">
						<view class="meGift" v-if="item.content.sendUserId!=user_id">
							<image src="../../../static/wode/setGift.png" mode=""></image>
							<view class="giftText">{{item.content.nickName}}给你发送了礼物<text @tap="toGiftCenter">礼物中心</text></view>
						</view>
						<view class="meGift" v-else>
							<image src="../../../static/wode/setGift.png" mode=""></image>
							<view class="giftText">{{item.content.sendNickName}}领取了你的礼物<text @tap="toGiftCenter">礼物中心</text></view>
						</view>
					</view>
					<view class="" v-else-if="item.type=='redtip'">
						<view class="meGift">
							<image src="../../../static/wode/littleRed.png" mode=""></image>
							<view class="giftText">{{item.content.sendNickName}}领取了你的<text class="text3">红包</text></view>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videoMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">发起视频<text class="test">&#xe64f;</text></text>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videocancelMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">已取消<text class="test">&#xe64f;</text></text>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videorefuseMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">已拒绝<text class="test">&#xe64f;</text></text>
						</view>
					</view>
					<view class="meTalk" v-else-if="item.type=='videoHangupMessage'">
						<image class="headImg" :src="user_info.avatar" mode=""></image>
						<view class="item_box2">
							<image class="xiaojiao" src="../../../static/jingyou/Inputbox_icon_i.png" mode=""></image>
							<text class="talk_item">通话时长 {{item.content.meesageTime}}<text class="test">&#xe64f;</text></text>
						</view>
					</view>
				</view>
				<!--对方发送的消息-->
			</view>

			<!-- <view v-for="(item,index) in otherTextMsg" :key="index"> -->
			<!-- 未定义区域 -->
			<!-- </view> -->
		</view>
		<!-- 消息渲染列表 -->

		<!-- 用户操作界面 -->
		<view class="body_bottom">
			<!-- 输入框 -->
			<view class="body_bottom_top">
				<!-- <image class="img_left" src="../../../static/jingyou/voice.png" mode=""></image> -->
				<!-- <image class="img_left" src="../../../static/jingyou/translate.png" mode=""></image> -->
				<image class="img_left" src="../../../static/wode/shezhi.png" mode="" @tap="toTalkSet"></image>
				<view class="inputContent" :class="{inputContent2:!isInput}">
					<input type="text" value="" v-model="newsText" />
					<!-- <view v-else class="longtapAudio">按住说话</view> -->
				</view>
				<image src="../../../static/jingyou/expression.png" mode="" @tap="toggleInputBox('emoji')"></image>
				<image class="img_right" src="../../../static/jingyou/imagetext.png" mode="" @tap="toggleInputBox('more')"></image>
				<view class="state1" @tap="onSendMsg">发送</view>
			</view>
			<!-- 输入框 -->

			<!-- 聊天弹出框 -->
			<view class="chat-input-box" v-if="toggleInput==true">
				<view class="chat-input-content" v-if="imgType=='more'">
					<view @tap="getToken" class="chat-input-item">
						<view>
							<image src="../../../static/jingyou/pictubiao.png"></image>
						</view>
						<text>照片</text>
					</view>
					<view class="chat-input-item" @tap="callToOther('video')">
						<view>
							<image src="../../../static/jingyou/sharetubiao.png"></image>
						</view>
						<text>视频</text>
					</view>
					<view class="chat-input-item" @tap="toRedPackets">
						<view>
							<image src="../../../static/jingyou/hongbao.png"></image>
						</view>
						<text>红包</text>
					</view>
					<view class="chat-input-item" @tap="setCard">
						<view>
							<image src="../../../static/jingyou/mingpian.png"></image>
						</view>
						<text>名片</text>
					</view>
					<view class="chat-input-item" @tap="tosetGift">
						<view>
							<image src="../../../static/jingyou/liwu1.png"></image>
						</view>
						<text>礼物</text>
					</view>
					<view class="chat-input-item" @tap="callToOther('class')">
						<view>
							<image src="../../../static/jingyou/haveclass.png"></image>
						</view>
						<text>上课</text>
					</view>
				</view>
				<view class="chat-input-content" v-else >
					<view class="imgItem" v-for="(item,index) in emojiChar" :key='index' @tap="selectEmoji(index)">
						<text>{{item}}</text>
					</view>
				</view>
			</view>
			<!-- 聊天弹出框 -->
		</view>
		<!-- 用户操作界面 -->


		<!--礼物弹框  -->
		<view class="gift_box" v-if="opengift==true">
			<image class="gift_topimg" src="http://img.curiousmore.com/tmp/wx2f4eaeb7b745ba4e.o6zAJs2bel8UMMafp-gtnT7OfHzo.PdiKNyEoWwts9f32e79dfd52a1a23ac0a00fe2a4a25b.png"
			 mode=""></image>
			<view class="gift_body">
				<image src="../../../static/avatar.jpg" mode=""></image>
				<text class="text2">玫瑰花</text>
				<view class="gift_btn">
					领取
				</view>
			</view>
			<text class="gift_back">回赠</text>
			<text class="gift_num">x1</text>
			<text class="gift_money">(价值500猫币)</text>
			<image class="deleteImg2" src="../../../static/jingyou/delete2.png" mode="" @tap="closeRed"></image>
		</view>
		<!-- 红包弹框 -->
		<view class="red_box" v-if="openred==true">
			<view class="red_top_box">
				<image class="red_top" src="http://img.curiousmore.com/tmp/wx2f4eaeb7b745ba4e.o6zAJs2bel8UMMafp-gtnT7OfHzo.yWghEGFLFMHf041b2c5aee819f424b905a5f7fda44a1.png"
				 mode=""></image>
				<image @tap="togetRed" class="red_open" src="../../../static/jingyou/openred.png" mode=""></image>
				<view class="people_box">
					<view class="people_top">
						<image :src="friendHeadUrl" mode=""></image>
						<text>{{redName}}</text>
					</view>
					<text class="text1">{{redRemarks}}</text>
				</view>
				<image class="deleteImg" src="../../../static/jingyou/delete2.png" mode="" @tap="closeRed"></image>
			</view>

		</view>

		<!-- 优质用户弹框 -->
		<view class="goodPeople" v-if="isGoodPeople==true">
			<image class="goodBg" src="http://img.curiousmore.com/tmp/wx2f4eaeb7b745ba4e.o6zAJs2bel8UMMafp-gtnT7OfHzo.HnQRQ9TebR9V9f01aa6fb09c075ac9a3539af9845769.png"
			 mode=""></image>
			<image class="goodTitle" src="http://img.curiousmore.com/tmp/wx2f4eaeb7b745ba4e.o6zAJs2bel8UMMafp-gtnT7OfHzo.bL2fSeFgtblif7b4a7fe6c8f7817848695935074f5d4.png"
			 mode=""></image>

			<view class="box1">
				<image class="cat1 index1" src="../../../static/jingyou/cat1.png" mode=""></image>
				<view class="kuangbox">
					<image class="kuang1" src="../../../static/jingyou/kuang1.png"></image>
					<text class="index1 first_text">消息回复更及时</text>
				</view>
			</view>
			<view class="box2">
				<view class="kuangbox">
					<image class="kuang1" src="../../../static/jingyou/kuang2.png"></image>
					<text class="index1">体验更温暖</text>
				</view>
				<image class="cat1 index1" src="../../../static/jingyou/cat2.png" mode=""></image>

			</view>
			<view class="box3">
				<view class="kuangbox">
					<image class="kuang1" src="../../../static/jingyou/kuang1.png"></image>
					<text class="index1">聊天更愉悦</text>
				</view>
				<image class="cat1 index1" src="../../../static/jingyou/cat3.png" mode=""></image>
			</view>
			<view class="chatNow">
				马上开聊
			</view>
			<text class="howGood" @tap="toHowGood">什么是优质用户？</text>
			<image class="deleteImg3" src="../../../static/jingyou/delete2.png" mode="" @tap="closeRed"></image>

		</view>

		<!-- 什么是优质用户 -->
		<view class="howGoodBox" v-if="isHowGood==true" style="background-size: 560upx 820upx;">
			<image class="howGoodBg" src="http://img.curiousmore.com/tmp/wx2f4eaeb7b745ba4e.o6zAJs2bel8UMMafp-gtnT7OfHzo.HnQRQ9TebR9V9f01aa6fb09c075ac9a3539af9845769.png"></image>

			<text class="howGoodTitle">什么是优质用户</text>
			<text>优质用户是“好奇地球”团队，通过线下审
				核、现场招募或者后台系统优质算法计算
				出来的用户，具备响应更及时，沟通更愉
				悦的特点</text>
			<text>成为优质用户可获得更多奖励，可直接推
				送到好奇地球优质用户列表，增加曝光率
				帮助您认识到更多的好友</text>
			<text>普通用与优质用户聊天需要消耗100猫
				币/人或会员次数</text>
			<text class="howGoodTitle">如何成为优质用户？</text>
			<text class="">1.实名认证</text>
			<text>2.身份认证</text>
			<text>3.相应语言能力(母语或语言专业）</text>
			<text>4.符合活跃规则</text>

			<image class="deleteImg4" src="../../../static/jingyou/delete2.png" mode="" @tap="closeRed"></image>
		</view>
		<mask :isShowMask='isShowMask' @closeMask='closeMask'></mask>
		<gift :isshowGift='isshowGift' :cat_coin='user_info.cat_coin' :pay_id='user_id' :payment_id='item' @hideAll='hideAll'
		 :payment_name="ThisName"></gift>
	</view>
</template>
<!-- <script src="../../../static/md5/md5.js"></script> -->
<script>
	// import hex_md5 from '../../../static/md5/md5.js' 
	// import util from '../../../common/util.js' //转换时间插件
	import webim from '../../../common/webim_wx.min.js' //腾讯云im包
	import webimhandler from '../../../common/webim_handler.js' //这个是所有事件的腾讯js，这个页面需要用到登录
	import qiniu from '../../../common/qiniuUploader.js'
	import mask from '../../../components/mask.vue'
	import gift from '../../../components/gift.vue'
	
	import {
		language
	} from '../../../common/country.js'
	// const call=uni.requireNativePlugin('Html5App-TencentCall'); 
	export default {
		components: {
			mask,
			gift
		},
		data() {
			return {
				isDJ: true,
				isNoData: true,
				contactList: [], //会话列表
				toggleInput: false,
				showInput: true,
				user_info: "",
				meTextMsg: [], //消息记录
				newsText: "", //要发送的文本消息
				user_id: uni.getStorageSync('user_id'),
				user_info: uni.getStorageSync('user_info'),
				onPullDownRefreshPoint: true, //进入页面自动滚到底部
				item: '', //聊天用户id
				imgList: "", //要发送给对方的图片
				selType: '',
				selToID: '',
				loginInfo: {},
				MsgSeq: '',
				ThisName: '',
				friendHeadUrl: '',
				newMsg: '',
				showAfterFanyi: false,
				afterFanyi: '',
				language: language,
				fanyiIndex: "",
				isShowMask: true,
				openred: false,
				isshowGift: false,
				opengift: false,
				isGoodPeople: true,
				isHowGood: false,
				order_no: '',
				redRemarks: '',
				redName: '',
				redItem: '', //红包信息
				// isvideo: '', //等待接听
				token: '', //图片上传token
				videoData: '', //视频数据
				appointment_id: '', //课程id
				video_id: '', //视频id
				timer:'',//计时器
				imgType:'',//弹出框类型
				emojiChar: ["😁", "😋", "😜", "😉", "😌", "😅", "😳", "😊", "😝", "😰", "😠", "😩", "😲", "😞", "😭", "😍", "😖", "😱", "😡", "😚", "😤"],//表情
			};
		},
		onLoad(options) {
			// console.log(options)
			this.item = options.item
			this.selType = options.chatType //群聊或者私聊
			this.MsgSeq = options.MsgSeq
			this.selToID = options.item //聊天对象（好友账号或群号）
			this.getProfilePortrait(this.item)
			console.log(this.selType, '聊天类型')
			if (options.paySuccess != undefined && options.paySuccess == true) {
				this.order_no = option.order_no
				console.log(this.order_no, '订单号')
				this.sendCustomMsg('redenvelopes')
			}
		},
		onShow() {
			var me=this
			this.user_info = uni.getStorageSync('user_info');
			this.loginInfo = uni.getStorageSync('loginInfo');
			console.log(this.user_id, '用户id')
			if (uni.getStorageSync('redData') != undefined && uni.getStorageSync('redData') != '') {
				this.sendCustomMsg('redenvelopes')
			}
			if (uni.getStorageSync('cardData') != undefined && uni.getStorageSync('cardData') != '') {
				this.sendCustomMsg('card')
			}
			if (this.selType != "GROUP") {
				this.getLastC2CHistoryMsgs() //查询聊天记录
				this.onMsgNotify()
			} else {
				this.getLastGroupHistoryMsgs() //查询聊天记录
				this.onMsgNotify()
			}
			if (webim.checkLogin()) { //检查是否登录返回true和false,不登录则重新登录
				console.log('已登录')
				this.onMsgNotify()
				// this.getRecentContactList(reqRecentSessCount)
			} else {
				console.log('登录')
				// TIM.registerPlugin({'cos-wx-sdk': COS}); // 在 login 前调用，以支持文件上传腾讯云对象存储
				this.webimLogin(loginInfo, listeners, options, reqRecentSessCount)
			}
			this.timer= setInterval(function(){
				var newMsgList=uni.getStorageSync('newMessage')
				if(newMsgList!=undefined){
						if (newMsgList.fromAccount == me.selToID) { //为当前聊天对象的消息
							me.meTextMsg.push(newMsgList)
							console.log(me.meTextMsg,'消息列表')
						}
					uni.removeStorageSync('newMessage')
					var selSess = webim.MsgStore.sessByTypeId(this.selType, this.item);
					webim.setAutoRead(selSess, true, true);
					//消息已读上报，以及设置会话自动已读标记
				}
			},1000)
		},
		onUnload(){
			clearInterval(this.timer)
		},
		updated() {
			// 			if(uni.getStorageSync('newMsg')){
			// 				this.newMsg = uni.getStorageSync('newMsg')
			// 				
			// 			}

			// 			console.log(this.newMsg)
			// 			console.log(1)
			// 			if (this.$store.state.getmsg != 0) {
			// 				if (this.selType != "GROUP") {
			// 					this.getLastC2CHistoryMsgs() //查询聊天记录
			// console.log('刷新内容')
			// this.onMsgNotify()
			// 				} else {
			// 					this.getLastGroupHistoryMsgs() //查询聊天记录
			// 					this.onMsgNotify()
			// 				}
			// 			}
		},
		mounted() {
			var sessMap = webim.MsgStore.sessMap();
			var selSess = webim.MsgStore.sessByTypeId(this.selType, this.item);
			// var listeners = {
			// 				"onConnNotify": this.onConnNotify //监听连接状态回调变化事件,必填
			// 					,
			// 				// 				"jsonpCallback": jsonpCallback //IE9(含)以下浏览器用到的jsonp回调函数，
			// 				// 					,
			// "onMsgNotify": this.onMsgNotify, //监听新消息(私聊，普通群(非直播聊天室)消息，全员推送消息)事件，必填
			// 				// 					,
			// 				// 				"onBigGroupMsgNotify": onBigGroupMsgNotify //监听新消息(直播聊天室)事件，直播场景下必填
			// 				// 					,
			// 				"onGroupSystemNotifys": this.onGroupSystemNotifys //监听（多终端同步）群系统消息事件，如果不需要监听，可不填
			// 				// 					,
			// 				// 				"onGroupInfoChangeNotify": onGroupInfoChangeNotify //监听群资料变化事件，选填
			// 				// 					,
			// 				// 				"onFriendSystemNotifys": onFriendSystemNotifys //监听好友系统通知事件，选填
			// 				// 					,
			// 				// 				"onProfileSystemNotifys": onProfileSystemNotifys //监听资料系统（自己或好友）通知事件，选填
			// 				// 					,
			// 				// 				"onKickedEventCall": onKickedEventCall //被其他登录实例踢下线
			// 				// 					,
			// 				// 				"onC2cEventNotifys": onC2cEventNotifys //监听C2C系统消息通道
			// 				// 					,
			// 				// 				"onAppliedDownloadUrl": onAppliedDownloadUrl //申请文件/音频下载地址的回调
			// 				// 					,
			// 				// 				"onLongPullingNotify": function(data) {
			// 				// 					console.debug('onLongPullingNotify', data)
			// 				// 				}
			// };
			// this.onMsgNotify()
			// this.webimLogin(listeners)
			webim.syncMsgs(this.onMsgNotify);
			setTimeout(this.onMsgNotify, 1000)

		},
		// 		watch:{
		// 			newMsg(curVal,oldVal){
		// 				console.log(curVal,oldVal + '这里')
		// 			}
		// 		},
		methods: {
			// 历史记录
			onMsgNotify(newMsgList) {
				
			},

			// 历史记录

			onConnNotify(resp) {
				var info;
				switch (resp.ErrorCode) {
					case webim.CONNECTION_STATUS.ON:
						webim.Log.warn('建立连接成功: ' + resp.ErrorInfo);
						break;
					case webim.CONNECTION_STATUS.OFF:
						info = '连接已断开，无法收到新消息，请检查下你的网络是否正常: ' + resp.ErrorInfo;
						uni.showToast({
							title: info,
							icon: 'none'
						})
						// console.log(info);						webim.Log.warn(info);
						break;
					case webim.CONNECTION_STATUS.RECONNECT:
						info = '连接状态恢复正常: ' + resp.ErrorInfo;
						uni.showToast({
							title: info,
							icon: 'none'
						})
						// console.log(info);
						webim.Log.warn(info);
						break;
					default:
						webim.Log.error('未知连接状态: =' + resp.ErrorInfo);
						break;
				}
			},
			//检测网络状态方法

			convertSoundMsgToHtml(content) {
				var second = content.getSecond(); //获取语音时长
				var downUrl = content.getDownUrl();
				if (webim.BROWSER_INFO.type == 'ie' && parseInt(webim.BROWSER_INFO.ver) <= 8) {
					return '[这是一条语音消息]demo暂不支持 IE8(含)以下浏览器播放语音,语音URL:' + downUrl;
				}
				return '<audio src="' + downUrl + '" controls="controls" onplay="onChangePlayAudio(this)" preload="none"></audio>';
			},
			//解析语音消息元素

			//解析图片消息元素
			convertImageMsgToHtml(content) {
				var smallImage = content.getImage(webim.IMAGE_TYPE.SMALL); //小图
				var bigImage = content.getImage(webim.IMAGE_TYPE.LARGE); //大图
				var oriImage = content.getImage(webim.IMAGE_TYPE.ORIGIN); //原图
				if (!bigImage) {
					bigImage = smallImage;
				}
				if (!oriImage) {
					oriImage = smallImage;
				}
				return "<img src='" + smallImage.getUrl() + "#" + bigImage.getUrl() + "#" + oriImage.getUrl() +
					"' style='CURSOR: hand' id='" + content.getImageId() + "' bigImgUrl='" + bigImage.getUrl() +
					"' onclick='imageClick(this)' />";
			},
			//解析图片消息元素

			//解析语音消息元素
			convertSoundMsgToHtml(content) {
				var second = content.getSecond(); //获取语音时长
				var downUrl = content.getDownUrl();
				if (webim.BROWSER_INFO.type == 'ie' && parseInt(webim.BROWSER_INFO.ver) <= 8) {
					return '[这是一条语音消息]demo暂不支持 IE8(含)以下浏览器播放语音,语音URL:' + downUrl;
				}
				return '<audio src="' + downUrl + '" controls="controls" onplay="onChangePlayAudio(this)" preload="none"></audio>';
			},
			//解析语音消息元素

			//获取当前用户昵称
			getProfilePortrait(ThisUserId) {
				var that = this
				var data = {
					"To_Account": [ThisUserId],
					"TagList": [
						"Tag_Profile_IM_Nick",
						"Tag_Profile_IM_Image"
					]
				}
				var options = data
				webim.getProfilePortrait(
					options,
					function(resp) {
						console.log(resp, '当前用户信息')
						that.ThisName = resp.UserProfileItem[0].ProfileItem[0].Value
						that.friendHeadUrl = resp.UserProfileItem[0].ProfileItem[1].Value
					}
				)
			},
			//获取当前用户昵称

			//获取最新的c2c历史消息,用于切换好友聊天，重新拉取好友的聊天消息
			getLastC2CHistoryMsgs(cbOk, cbError) {
				var selType = this.selType; //当前聊天类型
				var selToID = this.item //对方id
				var getPrePageC2CHistroyMsgInfoMap = {}; //保留下一次拉取好友历史消息的信息
				if (selType == webim.SESSION_TYPE.GROUP) {
					console.log('当前的聊天类型为群聊天，不能进行拉取好友历史消息操作');
					return;
				}
				if (!selToID || selToID == '@TIM#SYSTEM') {
					console.log('当前的聊天id非法，selToID=' + selToID);
					return;
				}
				var lastMsgTime = 0; //第一次拉取好友历史消息时，必须传0
				var msgKey = uni.getStorageSync('msgKey');
				var reqMsgCount = 15;
				var options = {
					'Peer_Account': selToID, //好友帐号
					'MaxCnt': reqMsgCount, //拉取消息条数
					'LastMsgTime': lastMsgTime, //最近的消息时间，即从这个时间点向前拉取历史消息
					'MsgKey': msgKey
				};
				var selSess = null;
				var _this = this;
				webim.MsgStore.delSessByTypeId(selType, selToID);
				webim.getC2CHistoryMsgs(
					options,
					function(resp) {
						console.log(resp, 'c2c最新历史消息') //打印和返回数据不相符？
						// 						console.log(_this.meTextMsg)
						var complete = resp.Complete; //是否还有历史消息可以拉取，1-表示没有，0-表示有
						if (resp.MsgList.length == 0) {
							webim.Log.warn("没有历史消息了:data=" + JSON.stringify(options));
							return;
						} else {
							// uni.setStorageSync('lastMsgTime', resp.LastMsgTime);
							uni.setStorageSync('msgKey', resp.MsgKey);
							_this.meTextMsg = []
							if (_this.onPullDownRefreshPoint) {
								setTimeout(function() {
									_this.clickGungun();
								}, 0)
							}
							for (var i = 0; i < resp.MsgList.length; i++) {
								var obj = {
									time: '',
									text: '',
									fromAccount: '',
									type: '',
									content: {},
								}
								if (resp.MsgList[i].elems[0].type != undefined && resp.MsgList[i].elems[0].type == 'TIMTextElem') {
									obj.type = 'text';
									obj.text = resp.MsgList[i].elems[0].content.text
								} else if (resp.MsgList[i].elems[0].type != undefined && resp.MsgList[i].elems[0].type == 'TIMCustomElem' &&
									resp.MsgList[i].elems[0].content.data != "") {
									obj.type = JSON.parse(resp.MsgList[i].elems[0].content.data).type
									obj.content = JSON.parse(resp.MsgList[i].elems[0].content.data)
									if (obj.type == 'videoMessage' || obj.type == 'videoAgreeMessage') {
										continue;
									}
								}
								obj.time = webim.Tool.formatTimeStamp(resp.MsgList[i].time) //时间戳
								obj.fromAccount = resp.MsgList[i].fromAccount //发送者id

								_this.meTextMsg.push(obj)
								// console.log(obj)
								// 								for (var j = 0; j < resp.MsgList[i].elems.length; j++) {
								// 									obj.text = resp.MsgList[i].elems[0].content.text
								// 									_this.meTextMsg.push(obj)
								// 									//可能循环进入死循环
								// 								}
							}
							console.log(_this.meTextMsg, '整理后的消息')

							// 							if (uni.getStorageSync('newMsg') != '' && uni.getStorageSync('newMsg')[0].fromAccount == selToID) {
							// 								_this.meTextMsg.push(uni.getStorageSync('newMsg')[0])
							// 								// uni.removeStorageSync('newMsg')
							// 								// console.log(_this.meTextMsg)
							// 							}
						}
						getPrePageC2CHistroyMsgInfoMap[selToID] = { //保留服务器返回的最近消息时间和消息Key,用于下次向前拉取历史消息
							'LastMsgTime': resp.LastMsgTime,
							'MsgKey': resp.MsgKey
						};
						//清空聊天界面
						// document.getElementsByClassName("msgflow")[0].innerHTML = "";
						if (cbOk)
							cbOk(resp.MsgList);
					},
				);

			},
			//获取最新的c2c历史消息,用于切换好友聊天，重新拉取好友的聊天消息

			//获取最新的群历史消息,用于切换好友聊天，重新拉取好友的聊天消息
			getMyGroup() {
				var _this = this
				// initGetMyGroupTable([]);
				let loginInfo = uni.getStorageSync('loginInfo')

				var options = {
					'Member_Account': '' + loginInfo.identifier,
					'Limit': 10,
					'Offset': 0,
					// 'GroupType':'',
					'GroupBaseInfoFilter': [
						'Type',
						'Name',
						'Introduction',
						'Notification',
						'FaceUrl',
						'CreateTime',
						'Owner_Account',
						'LastInfoTime',
						'LastMsgTime',
						'NextMsgSeq',
						'MemberNum',
						'MaxMemberNum',
						'ApplyJoinOption',
						'ShutUpAllMember'
					],
					'SelfInfoFilter': [
						'Role',
						'JoinTime',
						'MsgFlag',
						'UnreadMsgNum'
					],
					"MemberInfoFilter": [ // 如果需要成员信息，请添加此数组
						"Account", // 成员 ID
						"Role",
						"JoinTime",
						"MsgSeq",
						"MsgFlag",
						"LastSendMsgTime",
						"ShutUpUntil"
					],
				};
				webim.getJoinedGroupListHigh(
					options,
					function(resp) {
						// console.log(resp)
						// console.log(resp.GroupIdList[0].NextMsgSeq - 1, _this.item)
						var options = {
							'GroupId': _this.item,
							'ReqMsgSeq': resp.GroupIdList[0].NextMsgSeq - 1,
							'ReqMsgNumber': 100
						};
						if (options.ReqMsgSeq == null || options.ReqMsgSeq == undefined || options.ReqMsgSeq <= 0) {
							webim.Log.warn("该群还没有历史消息:options=" + JSON.stringify(options));
							console.log('该群还没有历史消息')
							return;
						}

						webim.syncGroupMsgs(
							options,
							function(msgList) {
								var getPrePageGroupHistroyMsgInfoMap = {};
								var selToID = _this.item
								console.log(msgList)
								if (msgList.length == 0) {
									console.log("该群没有历史消息了")
									_this.meTextMsg = uni.getStorageSync('meTextMsg')
									// console.log(_this.meTextMsg)
									if (_this.onPullDownRefreshPoint) {
										setTimeout(function() {
											_this.clickGungun();
										}, 0)
									}
									return;
								} else {
									_this.meTextMsg = []
									if (_this.onPullDownRefreshPoint) {
										setTimeout(function() {
											_this.clickGungun();
										}, 0)
									}
									for (var i = 0; i < msgList.length; i++) {
										if (msgList[i].subType == 0) {
											var obj = {
												time: '',
												text: '',
												fromAccount: '',
												name: '',
												fromAccountHeadurl: '',
												type: '',
											}
											if (msgList[i].elems[0].type == 'TIMTextElem') {
												obj.type = 'text'
											}
											obj.time = webim.Tool.formatTimeStamp(msgList[i].time) //时间
											obj.fromAccount = msgList[i].fromAccount //发送者id
											obj.text = msgList[i].elems[0].content.text
											obj.name = msgList[i].fromAccountNick
											obj.fromAccountHeadurl = msgList[i].fromAccountHeadurl
											_this.meTextMsg.push(obj)
										}
									}
									console.log(_this.meTextMsg, '整理后的消息')
								}
								// 														getPrePageC2CHistroyMsgInfoMap[selToID] = { //保留服务器返回的最近消息时间和消息Key,用于下次向前拉取历史消息
								// 															'LastMsgTime': resp.LastMsgTime,
								// 															'MsgKey': resp.MsgKey
								// 														};
								// console.log(msgList)
								getPrePageGroupHistroyMsgInfoMap[selToID] = {
									"ReqMsgSeq": msgList[msgList.length - 1].MsgSeq - 1
								};

							},
							function(err) {
								console.log(err.ErrorInfo);
							}
						)
						if (!resp.GroupIdList || resp.GroupIdList.length == 0) {
							uni.showToast({
								title: '您目前还没有加入任何群组',
								icon: 'none'
							})
							return;
						}

					},
					function(err) {
						console.log(err.ErrorInfo);
					}
				);
			},
			//获取最新的群历史消息,用于切换好友聊天，重新拉取好友的聊天消息

			//发送消息判断文本方法，
			//初步判断处理数据是否合格，文本合格执行handleMsgSend()将msgContent(消息文本)为参传递至handleMsgSend()，在handleMsgSend()中上传至腾讯云，
			onSendMsg() {
				if (this.newsText == "") {
					return
				}
				var _this = this
				var selToID = this.selToID
				// console.log(this.item +'用户聊天ID')
				var selType = this.selType; //当前聊天类型
				console.log(selToID, '聊天id')
				if (!selToID) {
					console.log("你还没有选中好友或者群组，暂不能聊天");
					return;
				}
				//获取消息内容
				var msgContent = this.newsText; //聊天内容
				var msgLen = webim.Tool.getStrBytes(msgContent) //聊天发送消息所占字符长度;
				if (msgContent.length < 1) {
					console.log("发送的消息不能为空!");
					return;
				}
				var maxLen, errInfo;
				if (selType == webim.SESSION_TYPE.C2C) {
					maxLen = webim.MSG_MAX_LENGTH.C2C;
					errInfo = "消息长度超出限制(最多" + Math.round(maxLen / 3) + "汉字)";
					// console.log('进入1' + maxLen + msgContent)
				} else {
					// console.log('进入2')
					maxLen = webim.MSG_MAX_LENGTH.GROUP;
					errInfo = "消息长度超出限制(最多" + Math.round(maxLen / 3) + "汉字)";
				}
				if (msgLen > maxLen) {
					// console.log('进入3')
					console.log(errInfo);
					return;
				}
				//发消息处理
				this.handleMsgSend(msgContent);
			},
			//发送消息判断文本方法

			// 上传发送消息文本方法
			handleMsgSend(msgContent) {
				var AdminAcount = 'qwe101'; //管理员账号？
				// var selType = webim.SESSION_TYPE.C2C; //当前聊天类型
				var selType = webim.SESSION_TYPE.GROUP; //群聊类型
				if (this.selType == 'C2C') {
					selType = webim.SESSION_TYPE.C2C
				} else {
					selType = webim.SESSION_TYPE.GROUP
				}
				var selToID = this.item; //当前选中聊天id（当聊天类型为私聊时，该值为好友帐号，否则为群号）
				var selSess = null; //当前聊天会话对象
				var recentSessMap = {}; //保存最近会话列表
				var reqRecentSessCount = 50; //每次请求的最近会话条数，业务可以自定义
				var isPeerRead = 1; //是否需要支持APP端已读回执的功能,默认为0。是：1，否：0。
				//默认好友头像
				var friendHeadUrl = 'img/friend.jpg'; //仅demo使用，用于没有设置过头像的好友
				//默认群头像
				var groupHeadUrl = 'img/group.jpg'; //仅demo使用，用于没有设置过群头像的情况
				//存放c2c或者群信息（c2c用户：c2c用户id，昵称，头像；群：群id，群名称，群头像）
				var infoMap = {}; //初始化时，可以先拉取我的好友和我的群组信息
				var maxNameLen = 12; //我的好友或群组列表中名称显示最大长度，仅demo用得到
				var reqMsgCount = 15; //每次请求的历史消息(c2c获取群)条数，仅demo用得到
				var pageSize = 15; //表格的每页条数，bootstrap table 分页时用到
				var totalCount = 200; //每次接口请求的条数，bootstrap table 分页时用到
				var emotionFlag = false; //是否打开过表情选择框
				var curPlayAudio = null; //当前正在播放的audio对象
				var getPrePageC2CHistroyMsgInfoMap = {}; //保留下一次拉取好友历史消息的信息
				var getPrePageGroupHistroyMsgInfoMap = {}; //保留下一次拉取群历史消息的信息
				var defaultSelGroupId = null; //登录默认选中的群id，选填，仅demo用得到
				if (!selSess) {
					var selSess = new webim.Session(selType, selToID, selToID, this.friendHeadUrl, Math.round(new Date().getTime() /
						1000));
				}
				var isSend = true; //是否为自己发送
				var seq = -1; //消息序列，-1表示sdk自动生成，用于去重
				var random = Math.round(Math.random() * 4294967296); //消息随机数，用于去重
				var msgTime = Math.round(new Date().getTime() / 1000); //消息时间戳
				var subType; //消息子类型

				if (this.selType == webim.SESSION_TYPE.C2C) {
					subType = webim.C2C_MSG_SUB_TYPE.COMMON;
				} else {
					//webim.GROUP_MSG_SUB_TYPE.COMMON-普通消息,
					//webim.GROUP_MSG_SUB_TYPE.LOVEMSG-点赞消息，优先级最低
					//webim.GROUP_MSG_SUB_TYPE.TIP-提示消息(不支持发送，用于区分群消息子类型)，
					//webim.GROUP_MSG_SUB_TYPE.REDPACKET-红包消息，优先级最高
					subType = webim.GROUP_MSG_SUB_TYPE.COMMON;
				}
				var msg = new webim.Msg(selSess, isSend, seq, random, msgTime, this.user_info.user_id, subType, this.user_info.nick_name);

				var text_obj, face_obj, tmsg, emotionIndex, emotion, restMsgIndex;
				//解析文本和表情
				var expr = /\[[^[\]]{1,3}\]/mg;
				var emotions = msgContent.match(expr);
				var _this = this
				if (!emotions || emotions.length < 1) {
					text_obj = new webim.Msg.Elem.Text(msgContent);
					msg.addText(text_obj);
				} else {
					for (var i = 0; i < emotions.length; i++) {
						tmsg = msgContent.substring(0, msgContent.indexOf(emotions[i]));
						if (tmsg) {
							text_obj = new webim.Msg.Elem.Text(tmsg);
							msg.addText(text_obj);
						}
						emotionIndex = webim.EmotionDataIndexs[emotions[i]];
						emotion = webim.Emotions[emotionIndex];

						if (emotion) {
							face_obj = new webim.Msg.Elem.Face(emotionIndex, emotions[i]);
							msg.addFace(face_obj);
						} else {
							text_obj = new webim.Msg.Elem.Text(emotions[i]);
							msg.addText(text_obj);
						}
						restMsgIndex = msgContent.indexOf(emotions[i]) + emotions[i].length;
						msgContent = msgContent.substring(restMsgIndex);
					}
					if (msgContent) {
						text_obj = new webim.Msg.Elem.Text(msgContent);
						msg.addText(text_obj);
					}
				}

				msg.PushInfo = {
					"PushFlag": 0,
					"Desc": '测试离线推送内容', //离线推送内容
					"Ext": '测试离线推送透传内容', //离线推送透传内容
					"AndroidInfo": {
						"Sound": "android.mp3" //离线推送声音文件路径。
					},
					"ApnsInfo": {
						"Sound": "apns.mp3", //离线推送声音文件路径。
						"BadgeMode": 1
					}
				};

				msg.PushInfoBoolean = false; //是否开启离线推送push同步
				msg.sending = 1;
				msg.originContent = msgContent;
				// addMsg(msg);
				// $("#send_msg_text").val('');
				// turnoffFaces_box();

				webim.sendMsg(msg, function(resp) { //发送消息方法
					//发送成功，把sending清理
					// 										var a = ;
					// 										uni.pageScrollTo({
					// 											scrollTop: a.height,
					// 											duration: 300
					// 										});
					// _this.getLastC2CHistoryMsgs()
					var date = new Date().getTime(); //当前时间
					var obj = {
						text: _this.newsText,
						time: _this.timeProcessing.formatDate(date),
						fromAccount: _this.user_id,
						type: 'text',
					}
					_this.meTextMsg.push(obj)
					_this.newsText = ''
					_this.clickGungun()
					// $("#id_" + msg.random).find(".spinner").remove();
					// webim.Tool.setCookie("tmpmsg_" + selToID, '', 0);
				}, function(err) {
					//console.log(err.ErrorInfo);
					//提示重发
					console.log(err)
					// 					uni.showToast({
					// 						title: err.ErrorInfo,
					// 						icon: 'none'
					// 					})
					// this.showReSend(msg);
				});
			},
			// 上传发送消息文本方法

			clickGungun() { //滚动到底部
				let view = uni.createSelectorQuery().select("#container");
				view.fields({
					size: true,
					rect: true,
					scrollOffset: true
				}, data => {
					console.log(data, '标签数据')
					uni.pageScrollTo({
						scrollTop: data.height,
						duration: 0,
					})
				}).exec();
			},
			showReSend(msg) { //发消息处理
				this.handleMsgSend(msg.originContent);
			},
			toggleInputBox(type) { //显示操作框
				this.isDJ = !this.isDJ
				// this.getLastC2CHistoryMsgs()
				if (this.toggleInput==true) {
					if(this.imgType==type){
						this.toggleInput = false;
					}else{
						this.toggleInput = true;
					}
				} else {
					this.toggleInput = true;
				}
				this.imgType=type
			},
			showInputOr() { //显示输入框还是按住录音
				if (this.showInput) {
					this.showInput = false;
				} else {
					this.showInput = true;
				}
			},
			setPic() {
				uni.chooseImage({
					sourceType: ['album'], // 从相册选择
					count: 1, // 只选一张，目前 SDK 不支持一次发送多张图片
					success: function(res) {
						// 2. 创建消息实例，接口返回的实例可以上屏
						let message = TIM.createImageMessage({
							to: 'user1',
							conversationType: TIM.TYPES.CONV_C2C,
							payload: {
								file: res
							},
							onProgress: function(event) {
								console.log('file uploading:', event)
							}
						});
						// 3. 发送图片
						let promise = TIM.sendMessage(message);
						promise.then(function(imResponse) {
							// 发送成功
							console.log(imResponse);
						}).catch(function(imError) {
							// 发送失败
							console.warn('sendMessage error:', imError);
						});
					}
				})
			},
			getToken() {
				var me = this;
				var data = {
					key: null,
				}
				this.myAjaxNewPost({
					model: 'push',
					controllerName: 'upload',
					actionName: 'getToken',
					data: data,
					successBack: function(res) {

						me.token = res.data.data
						console.log(me.token)
						if (me.token != '') {
							me.selectImg()
						}
					}
				})
			},
			selectImg() {
				var me = this;
				uni.showActionSheet({
					itemList: ['拍照', '相册'],
					itemColor: '#008AFF',
					success: function(res) {
						var index = res.tapIndex;
						if (index == 1) {
							uni.chooseImage({
								count: 1, //默认9
								sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
								sourceType: ['album'], //从相册选择
								success: function(res) {
									var filePath = res.tempFilePaths[0];
									// 交给七牛上传
									if (me.token != '') {
										qiniu.upload(filePath, (res) => {
											console.log(res.imageURL)
											var imageURL = res.imageURL
											uni.getImageInfo({
												src: imageURL,
												success: function(image) {
													console.log(image, '图片详情')
													me.sendPic(image)
												}
											})
											console.log('file url is: ' + res.fileUrl);
										}, (error) => {
											uni.showToast({
												title: '上传失败',
												icon: null
											});
											console.log('error: ' + error);
										}, {
											region: 'ECN',
											domain: 'http://img.curiousmore.com', // // bucket 域名，下载资源时用到。如果设置，会在 success callback 的 res 参数加上可以直接使用的 ImageURL 字段。否则需要自己拼接
											key: null, // [非必须]自定义文件 key。如果不设置，默认为使用微信小程序 API 的临时文件名
											// 以下方法三选一即可，优先级为：uptoken > uptokenURL > uptokenFunc
											uptoken: me.token, // 由其他程序生成七牛 uptoken
											// uptokenURL: 'http://192.168.6.6:8768/eg-api/push/upload/getToken', // 从指定 url 通过 HTTP GET 获取 uptoken，返回的格式必须是 json 且包含 uptoken 字段，例如： {"uptoken": "[yourTokenString]"}
											uptokenFunc: function() {
												return '[yourTokenString]';
											}
										}, (res) => {
											console.log('上传进度', res.progress)
											console.log('已经上传的数据长度', res.totalBytesSent)
											console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)

										}, () => {
											// 取消上传
										}, () => {
											// `before` 上传前执行的操作
										}, (err) => {
											// `complete` 上传接受后执行的操作(无论成功还是失败都执行)

										});
									}
								}
							});
						} else if (index == 0) {
							uni.chooseImage({
								count: 1, //默认9
								sizeType: ['compressed'], //可以指定是原图还是压缩图，默认二者都有
								sourceType: ['camera '], //相机
								success: function(res) {
									// console.log(JSON.stringify(res.tempFilePaths));
									var filePath = res.tempFilePaths[0];
									// 交给七牛上传
									if (me.token != '') {
										qiniu.upload(filePath, (res) => {
											console.log(res.imageURL)
											var imageURL = res.imageURL
											uni.getImageInfo({
												src: imageURL,
												success: function(image) {
													console.log(image, '图片详情')
													me.sendPic(image)
												}
											})
											console.log('file url is: ' + res.fileUrl);
										}, (error) => {
											uni.showToast({
												title: '上传失败',
												icon: null
											});
											console.log('error: ' + error);
										}, {
											region: 'ECN',
											domain: 'http://img.curiousmore.com', // // bucket 域名，下载资源时用到。如果设置，会在 success callback 的 res 参数加上可以直接使用的 ImageURL 字段。否则需要自己拼接
											key: null, // [非必须]自定义文件 key。如果不设置，默认为使用微信小程序 API 的临时文件名
											// 以下方法三选一即可，优先级为：uptoken > uptokenURL > uptokenFunc
											uptoken: me.token, // 由其他程序生成七牛 uptoken
											// uptokenURL: 'http://192.168.6.6:8768/eg-api/push/upload/getToken', // 从指定 url 通过 HTTP GET 获取 uptoken，返回的格式必须是 json 且包含 uptoken 字段，例如： {"uptoken": "[yourTokenString]"}
											uptokenFunc: function() {
												return '[yourTokenString]';
											}
										}, (res) => {
											console.log('上传进度', res.progress)
											console.log('已经上传的数据长度', res.totalBytesSent)
											console.log('预期需要上传的数据总长度', res.totalBytesExpectedToSend)

										}, () => {
											// 取消上传
										}, () => {
											// `before` 上传前执行的操作
										}, (err) => {
											// `complete` 上传接受后执行的操作(无论成功还是失败都执行)

										});
									}
								}
							});
						}
					}
				});
			},
			//上传图片
			uploadPic() {
				var selToID = this.item //对方id
				// 			    var uploadFiles = document.getElementById('upd_pic');
				// 			    var file = uploadFiles.files[0];
				var businessType; //业务类型，1-发群图片，2-向好友发图片
				if (this.selType == webim.SESSION_TYPE.C2C) { //个人聊天
					businessType = webim.UPLOAD_PIC_BUSSINESS_TYPE.C2C_MSG;
				} else if (this.selType == webim.SESSION_TYPE.GROUP) { //群聊天
					businessType = webim.UPLOAD_PIC_BUSSINESS_TYPE.GROUP_MSG;
				}
				//封装上传图片请求
				var opt = {
					'formId': 'updli_form', //上传图片表单id
					'fileId': 'updli_file', //file控件id
					'To_Account': selToID, //接收者
					'businessType': businessType, //图片的使用业务类型
					'fileType': webim.UPLOAD_RES_TYPE.FILE //表示上传文件
				};
				// 					webim.submitUploadFileForm(opt,
				// 						function (resp) {
				// 							console.log(resp)
				// 						},
				// 						function (err) {
				// 							console.log(err)
				// 						}
				// 					);
			},

			//发送图片消息
			sendPic(images) {
				var selToID = this.item //对方id
				var selType = this.selType
				var loginInfo = this.loginInfo
				if (!selToID) {
					console.log("您还没有好友，暂不能聊天");
					return;
				}

				if (!selSess) {
					var selSess = new webim.Session(selType, selToID, selToID, Math.round(new Date().getTime() / 1000));
				}
				var msg = new webim.Msg(selSess, true);
				var images_obj = new webim.Msg.Elem.Images(images.path);

				var img = images;
				var newImg;
				var type;
				switch (img.PIC_TYPE) {
					case 1: //原图
						type = 1; //原图
						break;
					case 2: //小图（缩略图）
						type = 3; //小图
						break;
					case 4: //大图
						type = 2; //大图
						break;
				}
				newImg = new webim.Msg.Elem.Images.Image(type, img.PIC_Size, img.width,
					img.height, img.path);
				images_obj.addImage(newImg);

				msg.addImage(images_obj);
				//调用发送图片接口
				webim.sendMsg(msg, function(resp) {
					// addMsg(msg);
					// curMsgCount++;
				}, function(err) {
					console.log(err.ErrorInfo);
				});
			},
			getLastGroupHistoryMsgs(cbOk, cbError) {

				if (this.item == webim.SESSION_TYPE.C2C) {
					console.log('当前的聊天类型为好友聊天，不能进行拉取群历史消息操作');
					return;
				}

				this.getMyGroup()
			},
			sendCustomMsg(type) { //发送自定义消息
				if (type == 'redenvelopes') {
					var data = uni.getStorageSync('redData')
				} else if (type == 'gift') {
					var data = uni.getStorageSync('giftData')
				} else if (type == 'card') {
					var data = uni.getStorageSync('cardData')
				} else if (type == 'redtip') {
					var data = uni.getStorageSync('redtipData')
				} else if (type == 'video') {
					// var newroomId = this.getRoomId()
					var newroomId = this.user_info.user_id //this.getRoomId()
					var data = {
						type: 'videoMessage',
						roomId: newroomId,
						userId: this.item,
						faceUrl: this.friendHeadUrl,
						nickName: this.ThisName,
						video_id: this.video_id,
						// duration: '',
						messageType: 'normal',
					}
					this.videoData = JSON.stringify(data)
				} else if (type == 'class') {
					var newroomId = this.user_info.user_id //this.getRoomId()
					var data = {
						type: 'videoMessage',
						roomId: newroomId,
						userId: this.item,
						faceUrl: this.friendHeadUrl,
						nickName: this.ThisName,
						appointment_id: this.appointment_id,
						video_id: this.video_id,
						// duration: '',
						messageType: 'gotoclass',
					}
					this.videoData = JSON.stringify(data)
				}
				var me = this
				data = JSON.stringify(data)
				var desc = "";
				var ext = "";

				var msgLen = webim.Tool.getStrBytes(data);
				var selToID = this.item;
				if (data.length < 1) {
					console.log("发送的消息不能为空!");
					return;
				}
				var maxLen, errInfo;
				if (this.selType == webim.SESSION_TYPE.C2C) {
					maxLen = webim.MSG_MAX_LENGTH.C2C;
					errInfo = "消息长度超出限制(最多" + Math.round(maxLen / 3) + "汉字)";
				} else {
					maxLen = webim.MSG_MAX_LENGTH.GROUP;
					errInfo = "消息长度超出限制(最多" + Math.round(maxLen / 3) + "汉字)";
				}
				if (msgLen > maxLen) {
					console.log(errInfo);
					return;
				}
				// console.log(selSess);
				console.log(111);
				if (!selSess) {
					var selSess = new webim.Session(this.selType, selToID, selToID, this.friendHeadUrl, Math.round(new Date().getTime() /
						1000));
				}
				var msg = new webim.Msg(selSess, true, -1, -1, -1, this.loginInfo.identifier, 0, this.loginInfo.identifierNick);
				var custom_obj = new webim.Msg.Elem.Custom(data, desc, ext);
				msg.addCustom(custom_obj);
				//调用发送消息接口
				msg.sending = 1;
				webim.sendMsg(msg, function(resp) {
					// addMsg(msg);
					// $("#id_" + msg.random).find(".spinner").remove();
					// if (selType == webim.SESSION_TYPE.C2C) {
					//     //私聊时，在聊天窗口手动添加一条发的消息，群聊时，长轮询接口会返回自己发的消息
					//     addMsg(msg);
					// }
					// $('#edit_custom_msg_dialog').modal('hide');
					var msgData = {
						content: JSON.parse(data),
						fromAccount: uni.getStorageSync('user_id'),
					}
					if (type == 'redenvelopes') {
						msgData.type = 'redenvelopes'
						uni.removeStorageSync('redData')
					} else if (type == 'gift') {
						msgData.type = 'gift'
						uni.removeStorageSync('giftData')
					} else if (type == 'card') {
						msgData.type = 'card'
						uni.removeStorageSync('cardData')
					} else if (type == 'redtip') {
						msgData.type = 'redtip'
						uni.removeStorageSync('redtipData')
					} else if (type == 'video') {
						msgData.type = 'video'
					}
					me.meTextMsg.push(msgData)

				}, function(err) {
					console.log(err.ErrorInfo);
				});
			},
			callToOther(type) { //视频
				// uni.navigateTo({
				// 	url: '../../../pages/Friend/videoChat/videoChat'
				// })
				this.queryClass(type)

			},

			fanyiThis(content, index) {
				this.fanyiIndex = index
				this.afterFanyi = ''
				// console.log(content)
				var me = this;
				var appid = '20190402000283752';
				var key = 'eLYpGzpGPrAKTE0dOzUJ';
				var salt = (new Date).getTime();
				var query = content;
				// 多个query可以用\n连接  如 query='apple\norange\nbanana\npear'
				var _from = 'auto';

				var str1 = appid + query + salt + key;
				var sign = this.MD5(str1);
				var to = '';
				console.log(this.user_info.mother_tongue, '母语')
				if (this.user_info.mother_tongue == '' || this.user_info.mother_tongue == undefined) {
					uni.navigateTo({
						url: '/pages/Other/countrySelect?type=母语'
					})
					uni.showToast({
						title: '请选择母语',
						icon: 'none'
					})
				} else {
					console.log(this.user_info.mother_tongue)
					for (var i = 0; i < this.language.length; i++) {
						if (this.user_info.mother_tongue == this.language[i].name || this.user_info.mother_tongue == this.language[i].enName) {
							to = this.language[i].Abbreviation
						}
					}
					if (this.user_info.mother_tongue == '汉语' || this.user_info.mother_tongue == '中文') {
						to = 'zh'
					}
				}
				if (_from == to) {
					uni.showToast({
						title: '已经是母语了哦',
						icon: 'none'
					})
					return
				}
				var data = {
					q: query,
					appid: appid,
					salt: salt,
					from: _from,
					to: to,
					sign: sign
				}
				// console.log(data)
				uni.request({
					url: 'http://api.fanyi.baidu.com/api/trans/vip/translate',
					method: 'GET',
					data: data,
					success(res) {
						// console.log(res)
						me.showAfterFanyi = true
						me.afterFanyi = res.data.trans_result[0].dst
					},
					fail() {
						uni.showToast({
							title: '请求数据失败',
							icon: "none"
						});
					},
				})
			},
			queryClass(type) {
				var me = this
				var user_id = uni.getStorageSync('user_id')
				var data = {
					user_id: user_id,
					other_id: this.item,
					status: 1,
					type: type
				}
				this.myAjaxNewPost({
					model: 'user',
					controllerName: 'videoDuration',
					actionName: 'insert',
					data: data,
					successBack: function(res) {
						console.log(res, '新增视频')
						if (res.data.data.is_video == false) {
							if (type == 'class') {
								uni.showModal({
									title: '提示',
									content: '当前时间段没有课程哦，快去预约吧',
									success: function(res) {
										if (res.confirm) {
											// console.log('用户点击确定');
											uni.navigateTo({
												url: '../../../pages/My/learnCenter/learnCenter'
											})
										} else if (res.cancel) {
											// console.log('用户点击取消');
										}
									}
								})
							} else if (type == 'video') {
								uni.showModal({
									title: '提示',
									content: '视频需要消耗猫币，当前猫币余额不足，快去充值吧',
									success: function(res) {
										if (res.confirm) {
											// console.log('用户点击确定');
											uni.navigateTo({
												url: '../../../pages/My/myMoney/myMoney'
											})
										} else if (res.cancel) {
											// console.log('用户点击取消');
										}
									}
								})
							}
						} else {
							me.video_id = res.data.data.video_id;
							if (res.data.data.appointment_id) {
								me.appointment_id = res.data.data.appointment_id;
							}
							if (res.data.data.end_time) {
								uni.setStorageSync('end_time', res.data.data.end_time)
							}
							// console.log(me.appointment_id, '课节id', type, '类型')

							me.sendCustomMsg(type)
							console.log(me.videoData, '上课数据')
							uni.navigateTo({
								url: '../../../pages/Friend/waitClass/waitClass?user_id=' + me.selToID + '&data=' + me.videoData
							})
						}
					}
				})
			},
			getRoomId() { //房间号随机数
				var nums = "";
				for (var i = 0; i < 6; i++) {
					nums += Math.floor(Math.random() * 10)
				}
				return nums;
			},
			tosetGift() {
				this.isShowMask = true
				this.isshowGift = true

			},
			closeRed() {
				this.openred = false
				this.isShowMask = false
				this.opengift = false
				this.isGoodPeople = false
				this.isHowGood = false
			},
			hideAll() {
				this.isShowMask = false
				this.isshowGift = false
				if (uni.getStorageSync('giftData') != undefined && uni.getStorageSync('giftData') != "") {
					this.sendCustomMsg('gift')
				}
				console.log('隐藏')
			},
			closeMask() {
				this.openred = false
				this.isShowMask = false
				this.isGoodPeople = false
				this.isHowGood = false
				this.isshowGift = false
			},
			isOpenRed(item) {
				console.log(item, '参数')
				this.isShowMask = true
				var me = this
				var data = {
					order_no: item.order_no
				}
				if (item.user_id == uni.getStorageSync('user_id')) {
					var headurl = uni.getStorageSync('avatar')
				} else {
					var headurl = this.friendHeadUrl
				}
				this.myAjaxNew({
					model: 'user',
					controllerName: 'userOrder',
					actionName: 'query',
					data: data,
					successBack: function(res) {
						console.log(res, '红包订单信息')
						if (res.data.data[0].status == 1) {
							me.openred = true
							me.redRemarks = item.remarks
							me.redName = item.sendNickName
							me.order_no = item.order_no
							me.redItem = item
						} else {
							me.isShowMask = false
							uni.navigateTo({
								url: '../../../pages/Friend/getRed/getRed?name=' + item.sendNickName + '&remarks=' + item.remarks +
									'&num=' + item.pay_count + '&head=' + headurl
							})
						}
					}
				})
				// if(iteem.content.user_id==uni.getStorageSync('user_id')){
				// 	uni.showToast({
				// 		title:'不能领取自己发送的红包哦',
				// 		icon:'none'
				// 	})
				// }
			},
			toHowGood() {
				this.isGoodPeople = false
				this.isHowGood = true
			},
			toTalkSet() { //去聊天设置页面
				if (this.selType == 'C2C') {
					uni.navigateTo({
						url: `/pages/Friend/talkSet/talkSet`
					})
				} else {
					uni.navigateTo({
						url: '/pages/Friend/groupSet/groupSet?id=' + this.item
					})
				}
			},
			setCard() {
				uni.navigateTo({
					url: `/pages/Friend/myFriend/myFriend?type=card`
				})
			},
			toRedPackets() {
				uni.navigateTo({
					url: "/pages/Friend/setRedPackets/setRedPackets?item=" + this.item + "&chatType=" + this.chatType + "&MsgSeq=" +
						this.MsgSeq
				})
			},
			togetRed() {
				var me = this;
				var data = {
					order_no: this.order_no
				}
				if (this.redItem.user_id == uni.getStorageSync('user_id')) {
					var headImg = uni.getStorageSync('avatar')
				} else {
					var headImg = this.friendHeadUrl
				}
				if (this.redItem.user_id == uni.getStorageSync('user_id')) {
					uni.showToast({
						title: '不能领取自己的红包',
						icon: 'none'
					})
					return
				} else {
					this.myAjaxNewPost({
						model: 'user',
						controllerName: 'userOrder',
						actionName: 'update',
						data: data,
						successBack: function(res) {
							console.log(res)
							// if(res.data.data=)
							var redtipData = {
								order_no: me.order_no,
								pay_count: me.redItem.pay_count,
								payment_id: me.redItem.payment_id,
								receiveNickname: uni.getStorageSync('nick_name'),
								remarks: me.redItem.remarks,
								sendNickName: me.redItem.sendNickName,
								type: 'redtip',
								"user_id": me.redItem.user_id,
							}
							me.isShowMask = false
							me.openred = false
							uni.setStorageSync('redtipData', redtipData)
							me.sendCustomMsg('redtip')
							uni.navigateTo({
								url: '../../../pages/Friend/getRed/getRed?name=' + me.redItem.sendNickName + '&remarks=' + me.redItem.remarks +
									'&num=' + me.redItem.pay_count + '&head=' + headImg
							})
						}
					})
				}
			},
			selectEmoji(index){//选择表情
				this.newsText=this.newsText + this.emojiChar[index]
			},

			toGiftCenter() {
				uni.navigateTo({
					url: `/pages/My/giftCenter/giftCenter`
				})
			},
			back() { //返回上一页面
				// var  hash = hex_md5("input string");
				// console.log(hash +'md5')
				uni.navigateBack({
					delta: 2
				})

			}
		},
	}
</script>

<style scoped>
	@font-face {
		font-family: iconfont;
		src: url('~@/static/iconfont.ttf');
	}

	.test {
		font-family: iconfont;
		margin-left: 20upx;
	}

	.head {
		width: 100%;
		display: flex;
		justify-content: space-between;
		height: 168upx;
		background: #ffffff;
		padding: 0 24upx;
		z-index: 200;
		position: fixed;
	}

	.head image {
		width: 20upx;
		height: 36upx;
		margin-right: 9upx;
	}

	.head_left {
		height: 82upx;
		width: 106upx;
		display: flex;
		align-items: center;
		line-height: 82upx;
		color: #666666;
		font-size: 32upx;
		padding-top: 70upx;

	}
	.head_mid{
		padding-top: 90upx;
	}

	.head_right {
		width: 106upx;
		display: flex;
		justify-content: space-around;
		/* padding-right: 24upx; */
	}

	.head_right image {
		width: 44upx;
		height: 44upx;
		/* padding-top: 68upx; */
		position: absolute;
		top: 185upx;
	}

	.time {
		color: #999999;
		font-size: 24upx;
		text-align: center;
		padding: 40upx 0;
	}

	.otherTalk {
		display: flex;
		padding: 0 24upx;
	}

	.meTalk {
		display: flex;
		flex-direction: row-reverse;
		padding: 0 24upx;
	}

	.otherTalk .head_box {
		position: relative;
		margin-right: 30upx;
	}

	.meTalk .headImg {
		margin-left: 30upx;
		width: 84upx;
	}

	.headImg {
		width: 84upx;
		height: 84upx;
		border-radius: 50%;
		overflow: hidden;
	}

	.sendImg-me {
		max-width: 320upx;
		max-height: 320upx;
		border-radius: 10upx;
	}

	.country {
		width: 28upx;
		height: 28upx;
		position: absolute;
		top: 60upx;
		left: 0;
	}

	.text_box {
		display: flex;
		flex-direction: column;
	}

	.item_box1 {
		background: #FFFFFF;
		border: #E6E6E6;
		border-radius: 10upx;
		position: relative;
		padding: 20upx 20upx;
		margin-bottom: 45upx;
	}

	.duration {
		color: rgba(153, 153, 153, 1);
		font-size: 28upx;
		margin-top: 30upx;
		margin-left: 15upx;
	}

	.duration.active {
		margin-right: 15upx;
		margin-left: 0;
	}

	.item_box1 .xiaojiao {
		width: 14upx;
		height: 34upx;
		position: absolute;
		left: -12upx;
		top: 8upx;
	}

	.voice-size {
		width: 26upx;
		height: 36upx;
	}

	.unread {
		width: 15upx;
		height: 15upx;
		background: rgba(230, 0, 0, 1);
		border: 1upx solid rgba(255, 255, 255, 1);
		border-radius: 50%;
		position: absolute;
		top: -5upx;
		right: -15upx;

	}

	.voice-size.active {
		transform: rotate(180deg);
	}

	.item_box2 {
		background: #47CECF;
		border: #E6E6E6;
		border-radius: 10upx;
		position: relative;
		padding: 18upx 33upx;
		margin-bottom: 45upx;
	}

	.item_box2 .xiaojiao {
		width: 14upx;
		height: 34upx;
		position: absolute;
		right: -12upx;
		top: 8upx;
	}

	.otherTalk .talk_item {
		color: #333333;
		font-size: 28upx;
		/* padding: 0 30upx; */
	}

	.meTalk .talk_item {
		color: #FFFFFF;
		font-size: 28upx;
		max-width: 500upx;
	}

	.fanyi {
		width: 36upx;
		height: 36upx;
		position: absolute;
		right: -45upx;
		top: 2upx;
	}

	.afterText {
		font-size: 28upx;
		border-top: 1upx solid #E6E6E6;
		padding-top: 10upx;
	}

	.body_itemA {
		padding-top: 128upx;
		margin-bottom: 114upx;
	}

	.body_itemB {
		padding-top: 128upx;
		margin-bottom: 520upx;
	}

	.body_bottom {
		background: #FFFFFF;
		position: fixed;
		bottom: 0;
		padding: 20upx 0;
		display: flex;
		flex-direction: column;
		width: 100%;
		/* height:548upx ; */
	}

	.body_bottom_top {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 0 24upx;
		box-sizing: border-box;
	}

	.body_bottom_top image {
		width: 56upx;
		height: 56upx;
	}

	.inputContent input {
		height: 56upx;
		width: 350upx;
		border: 1upx solid #E6E6E6;
	}

	.mingpian {
		display: flex;
		flex-direction: column;
	}

	.mingpianBox {
		width: 334upx;
	}

	.state1 {
		width: 100upx;
		height: 58upx;
		background: #46CECF;
		color: #FFFFFF;
		line-height: 58upx;
		text-align: center;
		font-size: 26upx;
		border-radius: 10upx;
	}

	.mingpian_top {
		display: flex;
		align-items: center;
		border-bottom: 1upx solid #E6E6E6;
		margin-bottom: 16upx;
	}

	.mingpian image {
		width: 80upx;
		height: 80upx;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 20upx;
		margin-bottom: 20upx;
	}

	.mingpian text {
		color: #333333;
		font-size: 28upx;
	}

	.item_box2 .mingpian text {
		color: #FFFFFF;
		font-size: 28upx;
	}

	.mingpian_bottom {
		color: #999999;
		font-size: 20upx;
	}

	.item_box2 .mingpian_bottom {
		color: #FFFFFF;
		font-size: 20upx;
	}

	.chat-input-content {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
		padding: 0 70upx;
		padding-top: 40upx;
		height: 450upx;
	}

	.chat-input-item {
		width: 100upx;
		height: 150upx;
		text-align: center;
		color: #666666;
		font-size: 20upx;
		margin-right: 70upx;
		margin-bottom: 50upx;
	}

	.chat-input-content .chat-input-item:nth-child(4n) {
		margin-right: 0;
	}
	.imgItem{
		margin:0 24upx;
	}

	.chat-input-item>view {
		height: 120upx;
	}

	.chat-input-item image {
		width: 100upx;
		height: 100upx;
	}

	.longtapAudio {
		width: 470upx;
		height: 56upx;
		border-radius: 30upx;
		line-height: 56upx;
		text-align: center;
		background: #F4FAFA;
		color: #9A9B9D;
		font-size: 30upx;
	}

	.item_box3 {
		position: relative;
	}

	.item_box3 image {
		width: 400upx;
		height: 174upx;
	}


	.item_box3 .redTextBox {
		position: absolute;
		color: #FFFFFF;
		font-size: 28upx;
		top: 30upx;
		left: 110upx;
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.isopen {
		opacity: 0.7;
	}

	.red_box {
		width: 590upx;
		height: 990upx;
		border-radius: 20upx;
		background: #FC6657;
		z-index: 3000;
		position: fixed;
		top: 106upx;
		left: 80upx;
		text-align: center;
	}

	.red_top_box {
		position: relative;
		display: flex;
		justify-content: center;
	}

	.red_top {
		width: 590upx;
		height: 780upx;
		position: absolute;
		left: 0;
	}

	.red_open {
		width: 120upx;
		height: 108upx;
		position: absolute;
		top: 714upx;
		left: 236upx;
	}

	.people_box {
		display: flex;
		flex-direction: column;
		align-items: center;
		color: #FFDDA2;
		z-index: 4000;
		position: absolute;
		top: 220upx;
	}

	.people_top {
		display: flex;
		align-items: center;
		font-size: 24upx;
		margin-bottom: 20upx;
	}

	.people_top image {
		width: 68upx;
		height: 68upx;
		margin-right: 16upx;
		border-radius: 50%;
		overflow: hidden;
	}

	.deleteImg {
		width: 46upx;
		height: 46upx;
		position: absolute;
		top: 1090upx;
		left: 272upx;
	}

	.text1 {
		font-size: 32upx;
	}

	.gift_box {
		width: 492upx;
		height: 428upx;
		background: rgba(255, 255, 255, 1);
		border-radius: 20upx;
		position: fixed;
		z-index: 3000;
		top: 460upx;
		left: 129upx;
	}

	.gift_topimg {
		width: 405upx;
		height: 198upx;
		position: absolute;
		top: -145upx;
		left: 44upx;
	}

	.gift_body {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: space-around;
	}

	.gift_body image {
		width: 152upx;
		height: 152upx;
		margin: 100upx 0 10upx 0;
	}

	.text2 {
		color: #999999;
		font-size: 24upx;
	}

	.gift_btn {
		color: #FFFFFF;
		width: 338upx;
		height: 56upx;
		background: #47CFCF;
		border-radius: 28upx;
		line-height: 56upx;
		text-align: center;
		font-size: 28upx;
		margin-top: 30upx;
	}

	.gift_back {
		position: absolute;
		color: #47CFCF;
		font-size: 24upx;
		right: 30upx;
		top: 74upx;
	}

	.gift_num {
		color: #333333;
		font-size: 32upx;
		position: absolute;
		top: 170upx;
		right: 110upx;
		font-weight: bold;
	}

	.gift_money {
		color: #999999;
		font-size: 16upx;
		position: absolute;
		top: 276upx;
		right: 25upx;
	}

	.deleteImg2 {
		width: 46upx;
		height: 46upx;
		position: absolute;
		top: 488upx;
		left: 224upx;
	}


	/* 优质用户 */
	.goodPeople {
		position: fixed;
		width: 560upx;
		height: 666upx;
		left: 95upx;
		top: 334upx;
		height: 334upx;
		z-index: 3000;
	}

	.goodBg {
		width: 560upx;
		height: 666upx;
		position: absolute;
		top: 0;
		left: 0;
	}

	.goodTitle {
		width: 400upx;
		height: 99upx;
		position: absolute;
		top: 60upx;
		left: 80upx;
	}

	.box1 {
		position: absolute;
		top: 183upx;
		left: 10upx;
		display: flex;
		color: #FF9D98;
	}

	.cat1 {
		width: 84upx;
		height: 106upx;
	}

	.kuangbox {
		width: 242upx;
		height: 78upx;
		font-size: 28upx;
		line-height: 78upx;
	}

	.kuangbox text {
		position: absolute;
		left: 39upx;
	}

	.kuangbox .first_text {
		left: 108upx;
	}

	.kuang1 {
		width: 242upx;
		height: 78upx;
		position: absolute;
	}

	.index1 {
		z-index: 3030
	}

	.box2 {
		position: absolute;
		top: 275upx;
		right: 10upx;
		display: flex;
		color: #FD5A96;
	}

	.box3 {
		position: absolute;
		top: 385upx;
		right: 170upx;
		display: flex;
		color: #33CBCC;
	}

	.chatNow {
		width: 400upx;
		height: 60upx;
		border-radius: 30upx;
		color: #FFFFFF;
		font-size: 28upx;
		text-align: center;
		line-height: 60upx;
		background: #33CBCC;
		position: absolute;
		left: 80upx;
		top: 524upx;
	}

	.howGood {
		color: #33CBCC;
		font-size: 20upx;
		text-decoration: underline;
		position: absolute;
		right: 20upx;
		top: 610upx;
	}

	.deleteImg3 {
		width: 46upx;
		height: 46upx;
		position: absolute;
		top: 726upx;
		left: 257upx;
	}

	.howGoodBox {
		width: 432upx;
		border-radius: 20upx;
		display: flex;
		flex-direction: column;
		color: #333333;
		font-size: 24upx;
		z-index: 3000;
		position: fixed;
		top: 257upx;
		left: 95upx;
		border-radius: 20upx;
		overflow: hidden;
		padding: 24upx;
		box-sizing: border-box;
		/* line-height: ; */
	}

	.howGoodBg {
		/* width: 432upx; */
		height: 820upx;
		position: absolute;
	}

	.howGoodBox text {
		z-index: 3010;
	}

	/* 	.text_box{
		z-index: 3010;
		padding: 112upx 64upx;
	} */

	.howGoodTitle {
		color: #33CBCC;
		font-size: 28upx;
		font-weight: bold;
	}

	.deleteImg4 {
		width: 46upx;
		height: 46upx;
		position: absolute;
		top: 880upx;
		left: 257upx;
	}

	.talkBox {
		margin-bottom: 20upx;
	}

	.meGift {
		display: flex;
		align-items: center;
		justify-content: center;
	}

	.giftText {
		background: #E6E6E6;
		font-size: 20upx;
		color: #999999;
		padding: 9upx 14upx;
		border-radius: 10upx;
	}

	.giftText text {
		color: #46CECF;
		margin-left: 10upx;
	}

	.meGift image {
		width: 39upx;
		height: 39upx;
		margin-right: 10upx;
	}

	.giftText .text3 {
		color: #FF4746;
	}


	/* 等待通话页面 */
	.people_box2 {
		display: flex;
		align-items: center;
		position: absolute;
		top: 106upx;
		left: 33upx;
	}

	.people_box2 image {
		width: 108upx;
		height: 108upx;
		border-radius: 50%;
		overflow: hidden;
		margin-right: 24upx;
	}

	.name_box {
		display: flex;
		flex-direction: column;
		color: #FFFFFF;
	}

	.bottom_box {
		display: flex;
		flex-direction: column;
		position: absolute;
		align-items: center;
		bottom: 128upx;
		width: 100%;
		color: #FFFFFF;
		font-size: 26upx;
	}

	.bottom_box image {
		width: 140upx;
		height: 140upx;
		margin-bottom: 24upx;
	}

	.text3 {
		font-size: 26upx;
	}

	.bottom_box2 {
		display: flex;
		justify-content: space-between;
		padding: 0 106upx;
		width: 100%;
		box-sizing: border-box;
		position: absolute;
		bottom: 128upx;
	}

	.wid {
		width: 140upx;
		display: flex;
		flex-direction: column;
		align-items: center;
		color: #FFFFFF;
		font-size: 26upx;
	}

	.wid image {
		width: 140upx;
		height: 140upx;
		margin-bottom: 24upx;
	}
	.emojiBox{
		display: flex;
		flex-wrap: wrap;
	}
</style>
